﻿@model Kooboo.CMS.Web.Areas.Contents.Models.FolderTreeModel
@using Kooboo.CMS.Content.Models
@using Kooboo.CMS.Content.Services
@{
    ViewData["InputName"] = Model.InputName;

    var treeId = "tree_" + Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10);
    
    var values = Kooboo.Web.Script.Serialization.JsonHelper.ToJSON(Model.Values ?? new List<string>());

    ViewData["InputName"] = Model.InputName;
    ViewData["IsSingle"] = Model.IsSingle;
    ViewData["IsEditing"] = Model.IsEditing;
    ViewData["Values"] = Model.Values;
    ViewBag.InputAttributes = Model.InputAttributes;
}

<div id="@treeId" class="block treeview">
    @Html.Partial("FolderTreeNode", Model.DataSource, ViewData)
</div>

<script>
    $(function () {
        $tree = $('#@treeId');
        $tree.find('li.tree-node').treeNode();
    });

</script>
